﻿@using Seal.Model
@using Seal.Helpers
@using SealWebServer.Controllers
@using SealWebServer.Models.Configuration
@{
    WebMainModel model = Model as WebMainModel;
    Repository repository = model.Repository;
    var authenticationConfig = ViewData["AuthenticationConfig"] as Authentication;
}


<!-- Login Modal -->
<div id="login-modal" class="modal fade" role="dialog" data-backdrop="static" data-keyboard="false" style="top:50px;z-index:25000;">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header btn-success" style="color:white;text-align:center;font-size:30px;border-top-left-radius:6px;border-top-right-radius:6px;">
                <h4 style="color:white;"><span class="glyphicon glyphicon-lock"></span> @repository.Configuration.WebProductName @repository.TranslateWeb("Login")</h4>
            </div>
            <div class="modal-body">
                @if (!(authenticationConfig?.IsUnique() ?? false))
                {
                    @if (!(authenticationConfig?.HideLoginPassword ?? false))
                    {
                        <div class="form-group">
                            <label for="username"><span class="glyphicon glyphicon-user"></span> @repository.TranslateWeb("User name")</label>
                            <input type="text" class="form-control" id="username" name="username" placeholder="@repository.TranslateWeb("Enter user name")" />
                        </div>
                        <div class="form-group">
                            <label for="password"><span class="glyphicon glyphicon-eye-open"></span> @repository.TranslateWeb("Password")</label>
                            <input type="password" class="form-control" id="password" placeholder="@repository.TranslateWeb("Enter password")" />
                        </div>

                        <a id="login-password-reset" href="">@repository.TranslateWeb("Forget your password ?")</a>
                    }
                    <button id="login-modal-submit" class="btn btn-default btn-success btn-block"><span class="glyphicon glyphicon-off"></span> @repository.TranslateWeb("Login")</button>
                }
                @if (authenticationConfig?.Enabled ?? false)
                {
                    <div class="text-center bg-success" style="padding: 6px 12px; margin-top: 15px; border-radius: 4px"><span class="glyphicon glyphicon-off"></span> @repository.TranslateWeb("Login") @Html.ActionLink(@authenticationConfig.Name ?? "Login", "Login", "Home")</div>
                }
            </div>
            <div class="modal-footer" style="text-align:left">
                <span id="login-modal-error" class="label label-danger" style="font-size:12px;white-space:normal;"></span>
            </div>
        </div>
    </div>
</div>

<!-- Security Code Modal -->
<div id="security-modal" class="modal fade" role="dialog" data-backdrop="static" data-keyboard="false" style="top:50px;z-index:26000;">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header btn-success" style="color:white;text-align:center;font-size:30px;border-top-left-radius:6px;border-top-right-radius:6px;">
                <h4 style="color:white;"><span class="glyphicon glyphicon-lock"></span> @repository.Configuration.WebProductName @repository.TranslateWeb("Two-Factor Authentication")</h4>
            </div>
            <div class="modal-body">
                <div  style="margin-bottom:20px;">
                <span id="security-code-message" class="label label-warning" style="font-size:14px;"></span>
                </div>
                <div class="form-group">
                    <label for="securitycode"><span class="glyphicon glyphicon-lock"></span> @repository.TranslateWeb("Security code")</label>
                    <input type="text" class="form-control" id="securitycode" name="securitycode" placeholder="@repository.TranslateWeb("Enter your security code")" />
                </div>
                <a class="security-back-to-login" href="">@repository.TranslateWeb("Back to login with user name and password")</a>
                <button id="security-modal-submit" class="btn btn-default btn-success btn-block"><span class="glyphicon glyphicon-off"></span> @repository.TranslateWeb("Login")</button>
            </div>
            <div class="modal-footer" style="text-align:left">  
                <span id="security-modal-error" class="label label-danger" style="font-size: 12px;"></span>
            </div>
        </div>
    </div>
</div>

<!-- Password Recover Modal -->
<div id="password-reset-modal" class="modal fade" role="dialog" data-backdrop="static" data-keyboard="false" style="top:50px;z-index:25000;">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header btn-warning" style="color:white;text-align:center;font-size:30px;border-top-left-radius:6px;border-top-right-radius:6px;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 style="color:white;"><span class="glyphicon glyphicon-alert"></span> @repository.TranslateWeb("Reset your password")</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="password-reset-name"><span class="glyphicon glyphicon-user"></span> @repository.TranslateWeb("Enter your user identifier or email")</label>
                    <input type="text" class="form-control" id="password-reset-name" name="password-reset-name" placeholder="@repository.TranslateWeb("User identifier or email")" />
                    <a class="security-back-to-login" href="">@repository.TranslateWeb("Back to login with user name and password")</a>
                </div>
                <button id="password-reset-submit" class="btn btn-default btn-warning btn-block"><span class="glyphicon glyphicon-check"></span> @repository.TranslateWeb("Reset password")</button>
            </div>
        </div>
    </div>
</div>

<!-- Password Recover Modal2 -->
<div id="password-reset-modal2" class="modal fade" role="dialog" data-backdrop="static" data-keyboard="false" style="top:50px;z-index:25000;">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header btn-warning" style="color:white;text-align:center;font-size:30px;border-top-left-radius:6px;border-top-right-radius:6px;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 style="color:white;"><span class="glyphicon glyphicon-alert"></span> @repository.TranslateWeb("Re-init your password")</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="password-reset1"><span class="glyphicon glyphicon-eye-open"></span> @repository.TranslateWeb("Enter your new password")</label>
                    <input type="password" class="form-control" id="password-reset1" name="password-reset1" placeholder="@repository.TranslateWeb("New password")" />
                </div>
                <div class="form-group">
                    <label for="password-reset2"><span class="glyphicon glyphicon-eye-close"></span> @repository.TranslateWeb("Confirm your new password")</label>
                    <input type="password" class="form-control" id="password-reset2" name="password-reset2" placeholder="@repository.TranslateWeb("New password")" />
                </div>
                <button id="password-reset-submit2" class="btn btn-default btn-warning btn-block"><span class="glyphicon glyphicon-check"></span> @repository.TranslateWeb("Change password")</button>
            </div>
        </div>
    </div>
</div>

<!-- Change Password Modal -->
<div id="change-password-modal" class="modal fade" role="dialog" data-backdrop="static" data-keyboard="false" style="top:50px;z-index:25000;">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header btn-warning" style="color:white;text-align:center;font-size:30px;border-top-left-radius:6px;border-top-right-radius:6px;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 style="color:white;"><span class="glyphicon glyphicon-alert"></span> @repository.TranslateWeb("Change your password")</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="password-change"><span class="glyphicon glyphicon-eye-open"></span> @repository.TranslateWeb("Enter your current password")</label>
                    <input type="password" class="form-control" id="password-change" name="password-change" placeholder="@repository.TranslateWeb("Current password")" />
                </div>
                <div class="form-group">
                    <label for="password-change1"><span class="glyphicon glyphicon-eye-open"></span> @repository.TranslateWeb("Enter your new password")</label>
                    <input type="password" class="form-control" id="password-change1" name="password-change1" placeholder="@repository.TranslateWeb("New password")" />
                </div>
                <div class="form-group">
                    <label for="password-change2"><span class="glyphicon glyphicon-eye-close"></span> @repository.TranslateWeb("Confirm your new password")</label>
                    <input type="password" class="form-control" id="password-change2" name="password-change2" placeholder="@repository.TranslateWeb("New password")" />
                </div>
                <button id="change-password-submit" class="btn btn-default btn-warning btn-block"><span class="glyphicon glyphicon-check"></span> @repository.TranslateWeb("Change password")</button>
            </div>
        </div>
    </div>
</div>


<!-- Folder Modal -->
<div id="folder-dialog" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content" style="top:60px">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">@repository.TranslateWeb("Manage Folders")</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <input class="form-control" style="display:inline;width:50%;" id="create-folder-name" placeholder="@repository.TranslateWeb("New folder name")" />
                    <button id="folder-create" type="button" class="btn btn-primary">@repository.TranslateWeb("Create new folder")</button>
                </div>
                <div class="form-group">
                    <input class="form-control" style="display:inline;width:50%;" id="rename-folder-name" placeholder="@repository.TranslateWeb("New folder path")" />
                    <button id="folder-rename" type="button" class="btn btn-primary">@repository.TranslateWeb("Rename or move folder")</button>
                </div>
                <div class="form-group">
                    <button id="folder-delete" type="button" class="btn btn-primary">@repository.TranslateWeb("Delete folder")</button>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">@repository.TranslateWeb("Close")</button>
            </div>
        </div>
    </div>
</div>


<!--Wait Dialog-->
<div class="modal fade in" id="wait-dialog" data-backdrop="static" data-keyboard="false" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body" style="text-align:center">
                <i class="fa fa-spinner fa-spin fa-2x fa-fw"></i>
                <h3 style="display:inline">@repository.TranslateWeb("Please wait")...</h3>
            </div>
        </div>
    </div>
</div>

<!-- Message Dialog -->
<div id="message-dialog" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" style="z-index:25000;">
    <div class="modal-dialog">
        <div class="modal-content" style="top: 60px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="@repository.TranslateWeb("Close")"><span aria-hidden="true">&times;</span></button>
                <h4 id="message-title" class="modal-title"></h4>
            </div>
            <div class="modal-body">
                <span id="message-text"></span>
            </div>
            <div class="modal-footer">
                <button id="message-cancel-button" type="button" class="btn btn-default" data-dismiss="modal">@repository.TranslateWeb("Cancel")</button>
                <button id="message-ok-button" type="button" class="btn btn-primary">@repository.TranslateWeb("OK")</button>
            </div>
        </div>
    </div>
</div>

<!-- File Name Dialog -->
<div id="report-name-dialog" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" style="z-index:25000;">
    <div class="modal-dialog">
        <div class="modal-content" style="top:60px">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="@repository.TranslateWeb("Close")"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">@repository.TranslateWeb("Enter your new file name")</h4>
            </div>
            <div class="modal-body">
                <input id="report-name" type="text" class="form-control" placeholder="@repository.TranslateReport("New report")" />
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">@repository.TranslateWeb("Cancel")</button>
                <button id="report-name-save" type="button" class="btn btn-primary">@repository.TranslateWeb("Save")</button>
            </div>
        </div>
    </div>
</div>


<!-- Profile Dialog -->
<div id="profile-dialog" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="@repository.TranslateWeb("Close")">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">@repository.TranslateWeb("Profile information")</h4>
            </div>
            <div class="modal-body">

                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("User name")</span>
                    <input class="form-control config-input-field" id="profile-user" disabled="disabled" />
                </div>
                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("User groups")</span>
                    <textarea rows="3" class="form-control config-input-field" id="profile-groups" disabled="disabled"></textarea>
                </div>
                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("Change password")</span>
                    <button id="profile-change-password" type="button" class="btn btn-default">@repository.TranslateWeb("Change password")</button>
                </div>

                <hr />

                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("Culture")</span>
                    <div class="config-input-field">
                        <select id="culture-select" data-width="100%"></select>
                    </div>
                </div>

                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("On startup")</span>
                    <div class="config-input-field">
                        <select id="onstartup-select" data-width="100%"></select>
                    </div>
                </div>

                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("Startup report name")</span>
                    <input class="form-control config-input-field" id="onstartup-reportname" />
                </div>

                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("Report execution mode")</span>
                    <div class="config-input-field">
                        <select id="executionmode-select" data-width="100%"></select>
                    </div>
                </div>

                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("Data source connections")</span>
                    <div id="default-connections" class="config-input-field"></div>
                </div>
            </div>
            <div class="modal-footer">
                <button id="profile-cancel" type="button" class="btn btn-default edit-profile" data-dismiss="modal">@repository.TranslateWeb("Cancel")</button>
                <button id="profile-save" type="button" class="btn btn-primary edit-profile">@repository.TranslateWeb("Save")</button>
                <button id="profile-close" type="button" class="btn btn-default" data-dismiss="modal">@repository.TranslateWeb("Close")</button>
            </div>
        </div>
    </div>
</div>


<!-- Configuration Dialog -->
<div id="config-dialog" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="@repository.TranslateWeb("Close")">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">@repository.TranslateWeb("Configuration and security")</h4>
            </div>
            <div class="modal-body">
                <div class="config-input-row">
                    <span class="config-input-label">@repository.TranslateWeb("Web product name")</span>
                    <input id="config-webproduct-name" type="text" class="form-control config-input-field" placeholder="@repository.TranslateWeb("Web product name")" />
                </div>
                
                <ul id="config-tab-control" class="nav nav-pills">
                    <li class="active"><a data-toggle="pill" href="#config-group-detail-content">@repository.TranslateWeb("Groups")</a></li>
                    <li class="assistants-panel"><a data-toggle="pill" href="#config-user-detail-content">@repository.TranslateWeb("Logins")</a></li>
                </ul>
                
                <div id="detail-section-1">
                    <div class="tab-content">
                        <div id="config-group-detail-content" class="tab-pane fade in active">
                            <div class="config-groups-panel">
                                <div class="config-input-row">
                                    <span class="config-input-label">@repository.TranslateWeb("Group name")</span>
                                    <div class="input-group config-input-field dropdown">
                                        <input id="config-group-name" type="text" class="form-control dropdown-toggle" data-toggle="dropdown" autocomplete="off" />
                                        <span class="input-group-btn">
                                            <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                        </span>
                                        <ul id="config-groups-dropdown" class="dropdown-menu" style="width:100%"></ul>
                                    </div>
                                </div>
                            </div>

                            <div class="config-input-row">
                                <span class="config-input-label">@repository.TranslateWeb("Edit configuration")</span>
                                <select class="form-control config-input-field" id="config-group-editconfiguration"></select>
                            </div>

                            <div class="config-input-row">
                                <span class="config-input-label">@repository.TranslateWeb("Edit profile")</span>
                                <select class="form-control config-input-field" id="config-group-editprofile"></select>
                            </div>

                            <div class="config-input-row">
                                <span class="config-input-label">@repository.TranslateWeb("Personal folder")</span>
                                <select class="form-control config-input-field" id="config-group-personalfolder"></select>
                            </div>

                            <div id="config-group-downloadupload-row" class="config-input-row">
                                <span class="config-input-label">@repository.TranslateWeb("Download/Upload")</span>
                                <select class="form-control config-input-field" id="config-group-downloadupload"></select>
                            </div>

                            <div class="group-folder-panel">
                                <h5 class="config-section-header">@repository.TranslateWeb("Folder Permissions")</h5>
                                
                                <div class="config-input-row">
                                    <span class="config-input-label">@repository.TranslateWeb("Folder")</span>
                                    <div class="input-group config-input-field dropdown">
                                        <input id="config-group-folder-name" type="text" class="form-control dropdown-toggle" data-toggle="dropdown" autocomplete="off" />
                                        <span class="input-group-btn">
                                            <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                        </span>
                                        <ul id="config-group-folders-dropdown" class="dropdown-menu" style="width:100%"></ul>
                                    </div>
                                </div>

                                <div class="config-input-row config-group-folder">
                                    <span class="config-input-label">@repository.TranslateWeb("Rights")</span>
                                    <select class="form-control config-input-field" id="config-group-folder-right"></select>
                                </div>

                                <div class="config-input-row config-group-folder">
                                    <span class="config-input-label">@repository.TranslateWeb("Manage sub-folders")</span>
                                    <select class="form-control config-input-field" id="config-group-folder-manage"></select>
                                </div>

                                <div class="config-input-row config-group-folder">
                                    <span class="config-input-label">@repository.TranslateWeb("Show sub-folders")</span>
                                    <select class="form-control config-input-field" id="config-group-folder-showsub"></select>
                                </div>

                                <div class="config-input-row config-group-folder">
                                    <span class="config-input-label">@repository.TranslateWeb("Expand in Treeview")</span>
                                    <select class="form-control config-input-field" id="config-group-folder-expand"></select>
                                </div>

                                <div class="config-input-row config-group-folder">
                                    <span class="config-input-label">@repository.TranslateWeb("Files only")</span>
                                    <select class="form-control config-input-field" id="config-group-folder-filesonly"></select>
                                </div>
                            </div>
                        </div>
                        
                        <div id="config-user-detail-content" class="tab-pane fade">
                            <div class="config-logins-panel">
                                <div class="config-input-row">
                                    <span class="config-input-label">@repository.TranslateWeb("Login ID")</span>
                                    <div class="input-group config-input-field dropdown">
                                        <input id="config-login-id" type="text" class="form-control dropdown-toggle" data-toggle="dropdown" autocomplete="off" />
                                        <span class="input-group-btn">
                                            <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                        </span>
                                        <ul id="config-logins-dropdown" class="dropdown-menu" style="width:100%"></ul>
                                    </div>
                                </div>
                            </div>

                            <div class="config-input-row">
                                <span class="config-input-label">@repository.TranslateWeb("Change password")</span>
                                <input type="password" class="form-control config-input-field" id="config-login-password" placeholder="@repository.TranslateWeb("Type a new password")" />
                            </div>

                            <div class="config-input-row config-login">
                                <span class="config-input-label">@repository.TranslateWeb("Name")</span>
                                <input id="config-login-name" type="text" class="form-control config-input-field" placeholder="@repository.TranslateWeb("Name")" />
                            </div>

                            <div class="config-input-row config-login">
                                <span class="config-input-label">@repository.TranslateWeb("Email")</span>
                                <input id="config-login-email" type="text" class="form-control config-input-field" placeholder="@repository.TranslateWeb("Email")" />
                            </div>

                            <div class="config-input-row config-login">
                                <span class="config-input-label">@repository.TranslateWeb("Phone")</span>
                                <input id="config-login-phone" type="text" class="form-control config-input-field" placeholder="@repository.TranslateWeb("Phone")" />
                            </div>

                            <div class="config-input-column config-login">
                                <span class="config-input-label">@repository.TranslateWeb("Groups")</span>
                                <select id="config-login-groups" multiple="multiple" class="form-control config-input-field" data-live-search="true" data-actions-box="true" data-size="10" data-width="100%"></select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button id="config-cancel" type="button" class="btn btn-default edit-config" data-dismiss="modal">@repository.TranslateWeb("Cancel")</button>
                <button id="config-save" type="button" class="btn btn-primary edit-config">@repository.TranslateWeb("Save")</button>
            </div>
        </div>
    </div>
</div>

